package com.example.tool.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

@RestController
@RequestMapping("/api")
public class RoleTestController {
    @GetMapping("/public/hello")
    public String publicHello() {
        return "Hello Public";
    }

    @GetMapping("/user/hello")
    public String userHello() {
        return "Hello User";
    }

    @GetMapping("/admin/hello")
    public String adminHello() {
        return "Hello Admin";
    }

    @GetMapping("/me")
    public Principal getCurrentUser(Principal principal) {
        return principal;
    }
}
